// formPackage/pages/platformModule/companyTeamMember/companyTeamMember.js
import { getMyTeamList } from "../../../../service/onetoone_service"
let app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    themeStyle: "",
    companyList: [

    ],
    isManager: false,
    page: 0,
    pageSize: 200,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getMyTeamList();
  },



  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (app.globalData.themeStyle) {
      this.setData({
        themeStyle: app.globalData.themeStyle
      })
    }
  },
  getMyTeamList() {
    wx.showLoading();
    getMyTeamList(this.data.page, this.data.pageSize).then(res => {
      console.log("JJLog:团队列表成功===:" + JSON.stringify(res));
      wx.hideLoading();
      if (res.code == 200) {
        this.setData({
          companyList: res.data
        })
      }
    }).catch(err => {
      wx.hideLoading();
      wx.showToast({
        title: err || "查询失败",
        icon: "none"
      })
      console.error("JJLog:getMyTeamList", err);
    })
  },

  /**
  * 用户点击右上角分享
  */
  onShareAppMessage: function () {
    let path = "";
    let title = "";
    let imageUrl = "";
    let name = app.globalData.name || app.globalData.nickName
    //达人分享
    path = "/pages/home/home?isShare=1" + "&userId=" + app.globalData.userId
    title = name + "邀请你加入他的团队";
    imageUrl = "https://jyhky.ylyc.top/yqbbbbbig_icon.png"

    return {
      title: title,
      path: path,
      imageUrl: imageUrl
    }
  },


})